87bc88
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 the original author or authors.
+ * Copyright 2011-2012 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,6 +57,15 @@
public class MergingPersistenceUnitManager extends DefaultPersistenceUnitManager
 		}
 	}
 
+	/* 
+	 * (non-Javadoc)
+	 * @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager#isPersistenceUnitOverrideAllowed()
+	 */
+	@Override
+	protected boolean isPersistenceUnitOverrideAllowed() {
+		return true;
+	}
+
 	void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui, PersistenceUnitInfo oldPui) {
 
 		for (URL url : oldPui.getJarFileUrls()) {
@@ -68,6 +77,14 @@
public class MergingPersistenceUnitManager extends DefaultPersistenceUnitManager
 			}
 		}
 
+		for (String className : oldPui.getManagedClassNames()) {
+
+			if (!pui.getManagedClassNames().contains(className)) {
+				log.debug("Adding class {} to PersistenceUnit {}", className, pui.getPersistenceUnitName());
+				pui.addManagedClassName(className);
+			}
+		}
+
 		pui.addJarFileUrl(oldPui.getPersistenceUnitRootUrl());
 	}
 }
